<div id="my" ng-controller="myCtrl">
    <section>
        <!--个人中心-->
    </section>

    <div class="container">
        <form action="/users/upload" method="POST" enctype="multipart/form-data">
            <div class="form-group">
                <div id="preview"><img class="portrait" ng-src="{{portrait}}" alt=""></div>
                <input type="file" name="photo" onchange="preview(this)" required accept=".jpg,.png">

                <input id="upload" type="submit" value="上传"></input>
            </div>
        </form>
    </div>

    <script type="text/javascript">
        function preview(file) {
            var prevDiv = document.getElementById('preview');
            if (file.files && file.files[0]) {
                var reader = new FileReader();
                reader.onload = function(evt) {
                    prevDiv.innerHTML = '<img src="' + evt.target.result + '" />';
                }
                reader.readAsDataURL(file.files[0]);
            } else {
                prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
            }
        }
    </script>



    <form class="form-horizontal" ng-submit="updateUser()">
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-6">
                <input type="text" class="form-control" disabled id="inputEmail3" placeholder="姓名" ng-model="user.name">
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>
            <div class="col-sm-6">
                <input type="email" class="form-control" id="inputEmail3" placeholder="邮箱" ng-model="user.email">
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">性别</label>
            <div class="col-sm-6">
                <label class="radio-inline">
                <input type="radio" name="gender" id="inlineRadio1" value="male" ng-model="user.gender"> 男
                </label>
                <label class="radio-inline">
                <input type="radio" name="gender" id="inlineRadio2" value="female" ng-model="user.gender"> 女
                </label>
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">年龄</label>
            <div class="col-sm-6">
                <input type="number" class="form-control" min="1" max="150" id="inputEmail3" placeholder="年龄" ng-model="user.age">
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">家庭地址</label>
            <div class="col-sm-6">
                <input type="text" class="form-control" id="inputEmail3" placeholder="家庭地址" ng-model="user.site">
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">出生年月</label>
            <div class="col-sm-6">
                <input type="date" class="form-control" id="inputEmail3" placeholder="出生年月" ng-model="user.birthday">
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default">保存</button>
            </div>
        </div>
    </form>

</div>